package com.mentaleye.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mentaleye.dal.dao.StudentInterviewAnalyzeDao;
import com.mentaleye.dal.model.StudentInterviewAnalyze;
import com.mentaleye.dal.model.StudentInterviewAnalyzeExample;
import com.mentaleye.dal.model.StudentInterviewAnalyzeExample.Criteria;
import com.mentaleye.service.StudentInterviewAnalyzeService;

@Service
public class StudentInterviewAnalyzeServiceImpl implements StudentInterviewAnalyzeService {

	@Autowired private StudentInterviewAnalyzeDao recordDao;
	
	@Override
	public boolean insertRecord(StudentInterviewAnalyze record) {
		return this.recordDao.insertRecord(record);
	}

	@Override
	public boolean updateRecord(StudentInterviewAnalyze record) {
		return this.recordDao.updateRecord(record);
	}

	@Override
	public StudentInterviewAnalyze getRecordByKey(long recordId) {
		StudentInterviewAnalyze record=null;
		StudentInterviewAnalyzeExample example=new StudentInterviewAnalyzeExample();
		Criteria criteria = example.createCriteria();
		criteria.andRecordIdEqualTo(recordId);
		List<StudentInterviewAnalyze> recordList = this.recordDao.getListByExample(example);
		if(!recordList.isEmpty()){
			record=recordList.get(0);
		}
		return record;
	}
	
	@Override
	public StudentInterviewAnalyze getRecordByInterviewId(long interviewId) {
		StudentInterviewAnalyze record=null;
		StudentInterviewAnalyzeExample example=new StudentInterviewAnalyzeExample();
		Criteria criteria = example.createCriteria();
		criteria.andInterviewIdEqualTo(interviewId);
		List<StudentInterviewAnalyze> recordList = this.recordDao.getListByExample(example);
		if(!recordList.isEmpty()){
			record=recordList.get(0);
		}
		return record;
	}

	@Override
	public List<StudentInterviewAnalyze> getList() {
		StudentInterviewAnalyzeExample example=new StudentInterviewAnalyzeExample();
		return this.recordDao.getListByExample(example);
	}

	@Override
	public boolean deleteByKey(long recordId) {
		StudentInterviewAnalyzeExample example=new StudentInterviewAnalyzeExample();
		Criteria criteria = example.createCriteria();
		criteria.andRecordIdEqualTo(recordId);
		return this.recordDao.deleteByExample(example);
	}

	@Override
	public List<Map<String, Object>> getListByMap(Map<String, Object> map) {
		return this.recordDao.getListByMap(map);
	}
}
